<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>设备维护</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body class="bg-gray-50">
    <!-- Header -->
    <div class="bg-white p-4 shadow-sm">
        <div class="flex items-center justify-between">
            <h1 class="text-xl font-semibold text-gray-800">设备维护</h1>
            <div class="flex items-center space-x-2">
                <button class="p-2 text-gray-600 hover:text-gray-800">
                    <i class="fas fa-search"></i>
                </button>
                <button class="p-2 text-gray-600 hover:text-gray-800">
                    <i class="fas fa-plus"></i>
                </button>
            </div>
        </div>
    </div>

    <!-- Main Content -->
    <div class="p-4 space-y-4">
        <!-- Equipment Status Overview -->
        <div class="bg-white rounded-lg shadow-sm p-4">
            <div class="flex justify-between items-center mb-4">
                <h2 class="text-lg font-medium text-gray-800">设备状态概览</h2>
                <span class="text-sm text-gray-500">实时更新</span>
            </div>
            <div class="grid grid-cols-3 gap-4">
                <div class="text-center">
                    <div class="text-2xl font-bold text-green-600">12</div>
                    <div class="text-sm text-gray-600">运行中</div>
                </div>
                <div class="text-center">
                    <div class="text-2xl font-bold text-yellow-600">2</div>
                    <div class="text-sm text-gray-600">待维护</div>
                </div>
                <div class="text-center">
                    <div class="text-2xl font-bold text-red-600">1</div>
                    <div class="text-sm text-gray-600">故障中</div>
                </div>
            </div>
        </div>

        <!-- Maintenance Schedule -->
        <div class="bg-white rounded-lg shadow-sm p-4">
            <h2 class="text-lg font-medium text-gray-800 mb-4">维护计划</h2>
            <div class="space-y-3">
                <div class="flex items-center justify-between p-3 bg-yellow-50 rounded-lg">
                    <div class="flex items-center space-x-3">
                        <i class="fas fa-tools text-yellow-600"></i>
                        <div>
                            <div class="font-medium">CNC-001</div>
                            <div class="text-xs text-gray-500">计划维护时间: 今天 14:00</div>
                        </div>
                    </div>
                    <button class="px-3 py-1 bg-yellow-600 text-white rounded-full text-sm">
                        待处理
                    </button>
                </div>
                <div class="flex items-center justify-between p-3 bg-green-50 rounded-lg">
                    <div class="flex items-center space-x-3">
                        <i class="fas fa-tools text-green-600"></i>
                        <div>
                            <div class="font-medium">CNC-002</div>
                            <div class="text-xs text-gray-500">计划维护时间: 明天 10:00</div>
                        </div>
                    </div>
                    <button class="px-3 py-1 bg-green-600 text-white rounded-full text-sm">
                        已安排
                    </button>
                </div>
            </div>
        </div>

        <!-- Equipment Health -->
        <div class="bg-white rounded-lg shadow-sm p-4">
            <h2 class="text-lg font-medium text-gray-800 mb-4">设备健康度</h2>
            <canvas id="healthChart" height="200"></canvas>
        </div>

        <!-- Recent Alerts -->
        <div class="bg-white rounded-lg shadow-sm p-4">
            <h2 class="text-lg font-medium text-gray-800 mb-4">最近告警</h2>
            <div class="space-y-3">
                <div class="flex items-center justify-between p-3 bg-red-50 rounded-lg">
                    <div class="flex items-center space-x-3">
                        <i class="fas fa-exclamation-circle text-red-600"></i>
                        <div>
                            <div class="font-medium">CNC-003 温度异常</div>
                            <div class="text-xs text-gray-500">发生时间: 10:30</div>
                        </div>
                    </div>
                    <span class="text-sm text-red-600">紧急</span>
                </div>
                <div class="flex items-center justify-between p-3 bg-yellow-50 rounded-lg">
                    <div class="flex items-center space-x-3">
                        <i class="fas fa-exclamation-triangle text-yellow-600"></i>
                        <div>
                            <div class="font-medium">CNC-001 需要维护</div>
                            <div class="text-xs text-gray-500">发生时间: 09:15</div>
                        </div>
                    </div>
                    <span class="text-sm text-yellow-600">警告</span>
                </div>
            </div>
        </div>
    </div>

    <script>
        // Equipment Health Chart
        const ctx = document.getElementById('healthChart').getContext('2d');
        new Chart(ctx, {
            type: 'radar',
            data: {
                labels: ['温度', '振动', '压力', '速度', '精度'],
                datasets: [{
                    label: '设备健康度',
                    data: [85, 90, 88, 92, 95],
                    backgroundColor: 'rgba(22, 119, 255, 0.2)',
                    borderColor: '#1677ff',
                    pointBackgroundColor: '#1677ff',
                    pointBorderColor: '#fff',
                    pointHoverBackgroundColor: '#fff',
                    pointHoverBorderColor: '#1677ff'
                }]
            },
            options: {
                responsive: true,
                scales: {
                    r: {
                        angleLines: {
                            display: true
                        },
                        suggestedMin: 0,
                        suggestedMax: 100
                    }
                }
            }
        });
    </script>
</body>
</html> 